package bean;

import org.springframework.beans.factory.FactoryBean;

import entity.Book;

public class DiscountBookFactoryBean implements FactoryBean {
	private int bookId;
	private String bookName;
	private double bookPrice;
	private double discount;
	@Override
	public Object getObject() throws Exception {
		Book book = new Book();
		book.setId(bookId);
		book.setName(bookName);
		book.setPrice(bookPrice*discount);
		return book;
	}

	@Override
	public Class getObjectType() {
		return Book.class;
	}

	@Override
	public boolean isSingleton() {
		return false;
	}

	public int getBookId() {
		return bookId;
	}

	public void setBookId(int bookId) {
		this.bookId = bookId;
	}

	public String getBookName() {
		return bookName;
	}

	public void setBookName(String bookName) {
		this.bookName = bookName;
	}

	public double getBookPrice() {
		return bookPrice;
	}

	public void setBookPrice(double bookPrice) {
		this.bookPrice = bookPrice;
	}

	public double getDiscount() {
		return discount;
	}

	public void setDiscount(double discount) {
		this.discount = discount;
	}

}
